using System;
using System.BusinessObjects.Transactions;
using Blazing.BusinessObjects.Tagging;
using NHibernate;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.Queries
{
    public class QrySearchTaxonomyTagStatisticsByParent
    {
         public static IQuery Query(int parentID, int numberToGet)
        {
            string hql = "select distinct t from TaxonomyTag t, StatisticTaxonomyTag stat where t.ID = stat.ID and t.ParentID=:parentID order by stat.total";
            IQuery qry = UnitOfWork.CurrentSession.CreateQuery(hql);
            qry.SetInt32("parentID", parentID);            
            qry.SetMaxResults(numberToGet);
            return qry;
        }
    }
}
